require_relative "helper"
require "numbers"

describe "Numbers" do

  it "must convert specific gravity to Plato" do
    1.055.to_plato.must_equal 13.5
    1.120.to_plato.must_equal 28.0
  end

  it "must convert Plato to specific gravity" do
    13.5.to_specific_gravity.must_equal 1.055
    28.0.to_specific_gravity.must_equal 1.120
      28.to_specific_gravity.must_equal 1.120
  end

  it "must convert specific gravity to temperature corrected specific gravity" do
    (1.055.to_temperature_corrected_specific_gravity  3).must_equal 1.054
    (1.055.to_temperature_corrected_specific_gravity 40).must_equal 1.062
    (1.055.to_temperature_corrected_specific_gravity 80).must_equal 1.082
  end

  it "must convert Fahenheit to Celsius" do
     37.to_celsius.must_equal 3
    104.to_celsius.must_equal 40
    176.to_celsius.must_equal 80
  end

  it "must convert Celsius to Fahenheit" do
     3.to_fahrenheit.must_equal 37
    40.to_fahrenheit.must_equal 104
    80.to_fahrenheit.must_equal 176
  end

  it "must convert gallons to liters" do
    5.5.to_liters.must_equal 20.8
      5.to_liters.must_equal 18.9
  end

  it "must convert quarts to liters" do
    (20.5.to_liters :quarts).must_equal 19.4
      (16.to_liters :quarts).must_equal 15.1
  end

  it "must convert ounces to grams" do
      2.to_grams.must_equal 56.7
    4.5.to_grams.must_equal 127.6
  end

  it "must convert grams to ounces" do
       56.to_ounces.must_equal 2.0
    127.6.to_ounces.must_equal 4.5
  end

  it "must convert pounds to kilograms" do
      10.to_kilograms.must_equal 4.5
    20.5.to_kilograms.must_equal 9.3
  end

  it "must convert kilograms to pounds" do
       4.to_pounds.must_equal 8.8
    10.6.to_pounds.must_equal 23.4
  end

end
